package com.yhd.tomcat.service;

import com.yhd.tomcat.handler.Handler;
import com.yhd.tomcat.req.BaseRequest;
import com.yhd.tomcat.resp.BaseResponse;

import java.util.Map;

/**
 * @author yhd
 * @email yinhuidong1@xiaomi.com
 * @description TODO
 * @since 2021/6/10 下午3:17
 */
public abstract class BaseService extends Handler {

    private final String GET = "GET";


    public void service(BaseRequest request, BaseResponse response) throws Exception {
        if (GET.equalsIgnoreCase(request.getMethod()))
            doGet(request, response);
        else
            doPost(request, response);
    }

    protected abstract void doPost(BaseRequest request, BaseResponse response) throws Exception;

    protected abstract void doGet(BaseRequest request, BaseResponse response) throws Exception;


}
